﻿/*
-------------------------------------
    Rodeo Game Engine

    Rodeo IO Module
    FileDDS.h - header file

    Copyright(c) Marcin Goryca
-------------------------------------
*/
#ifndef RODEO_IO_FILEDDS_H_
#define RODEO_IO_FILEDDS_H_

#ifndef RODEO_GLLIBS_H_
#include "..\gllibs.h"
#endif    //RODEO_GLLIBIS_H_

#ifndef RODEO_CORE_CONSTANTS_H_
#include "core\constants.h"
#endif    //RODEO_CORE_CONSTANTS_H_

#ifndef RODEO_CORE_ERROR_H_
#include "core\error.h"
#endif    //RODEO_CORE_ERROR_H_

#ifndef RODEO_CORE_COLORS_H_
#include "renderer\colors.h"
#endif    //RODEO_CORE_COLORS_H_

#ifndef RODEO_RENDERER_IMAGE_H_
#include "renderer\image.h"
#endif    //RODEO_RENDERER_IMAGE_H_

#ifndef RODEO_IO_LOG_H_
#include "io\log.h"
#endif    //RODEO_IO_LOG_H_

namespace rodeoio
{
class FileDDS : public rodeorenderer::Image
{
public:
    FileDDS(){}

    virtual ~FileDDS();

    virtual bool open(const char* fileName);

    virtual const char* getClassName()const { return "FileDDS"; }

    rodeocore::ui getTexture() const
    {
        return texture_;
    }

    void setTexture(rodeocore::ui new_texture)
    {
        texture_ = new_texture;
    }

private:
    void flipColorBlock(GLubyte* data);

    virtual void draw(float x, float y);

    virtual void release();

    void read(const char* fileName);

    void flipDXT1(GLubyte* data);

//==== MEMBERS ====//

    // unsigned int texture - variable to store texture object 
    rodeocore::ui texture_;

    rodeocore::DDS_HEADER dds_;
};
}    //end of rodeoio namespace
#endif	//RODEO_IO_FILEDDS_H_